package com.zhf.entity;

/**
 * @Author: ZhaoHuanfeng
 * @Date: 2020/9/27 15:13
 */

/**
 * 对应中间表
 * 表示的是一个订单中所有商品的信息
 *  CREATE TABLE `orderitem` (
 *   `itemid` varchar(32) NOT NULL,
 *   `pid` varchar(32) DEFAULT NULL,
 *   `oid` varchar(32) DEFAULT NULL,
 *   PRIMARY KEY (`itemid`),
 *   KEY `fk_0001` (`pid`),
 *   KEY `fk_0002` (`oid`),
 *   CONSTRAINT `fk_0001` FOREIGN KEY (`pid`) REFERENCES `product` (`pid`),
 *   CONSTRAINT `fk_0002` FOREIGN KEY (`oid`) REFERENCES `orders` (`oid`)
 * ) ENGINE=InnoDB DEFAULT CHARSET=utf8
 */
public class OrderItem {

    //订单项ID
    private String itemid;

    //外键 指向商品表的主键
    private String pid;

    //外键 指向订单表的主键
    private String oid;

    //订单项中商品的详细信息
    private Product product;

    //订单项所属的订单的详细信息
     private Orders orders;

    public String getItemid() {
        return itemid;
    }

    public void setItemid(String itemid) {
        this.itemid = itemid;
    }

    public String getPid() {
        return pid;
    }

    public void setPid(String pid) {
        this.pid = pid;
    }

    public String getOid() {
        return oid;
    }

    public void setOid(String oid) {
        this.oid = oid;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    public Orders getOrders() {
        return orders;
    }

    public void setOrders(Orders orders) {
        this.orders = orders;
    }

    @Override
    public String toString() {
        return "OrderItem{" +
                "itemid='" + itemid + '\'' +
                ", pid='" + pid + '\'' +
                ", oid='" + oid + '\'' +
                ", product=" + product +
                ", orders=" + orders +
                '}';
    }
}
